﻿using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
    public class GoodDeclarationMap : EntityTypeConfiguration<GoodDeclaration> {
        public GoodDeclarationMap() {
            // table
            ToTable("mc_GoodDeclaration", "dbo");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.GoodSKU)
                .HasColumnName("GoodSKU")
                .IsOptional();
            Property(t => t.CompanyName)
                .HasColumnName("CompanyName")
                .IsOptional();
            Property(t => t.HSCode)
                .HasColumnName("HSCode")
                .IsOptional(); 
            Property(t => t.GoodName)
                .HasColumnName("GoodName")
                .IsRequired();
            Property(t => t.GoodDescription)
                .HasColumnName("GoodDescription")
                .IsRequired();
            Property(t => t.Model)
                .HasColumnName("Model")
                .IsRequired();
            Property(t => t.Unit)
                .HasColumnName("Unit")
                .IsRequired();
            Property(t => t.MinUnit)
                .HasColumnName("MinUnit")
                .IsRequired();
            Property(t => t.Ingredient)
                .HasColumnName("Ingredient")
                .IsRequired();
            Property(t => t.Barcode)
                .HasColumnName("Barcode")
                .IsRequired();
            Property(t => t.Category)
                .HasColumnName("Category")
                .IsRequired();
            Property(t => t.Application)
                .HasColumnName("Application")
                .IsRequired();
            Property(t => t.ProducCountry)
                .HasColumnName("ProducCountry")
                .IsRequired();
            Property(t => t.ProducCompany)
                .HasColumnName("ProducCompany")
                .IsRequired();
            Property(t => t.Brand)
                .HasColumnName("Brand")
                .IsRequired();
            Property(t => t.Supplier)
                .HasColumnName("Supplier")
                .IsRequired();
            Property(t => t.AuditStatus)
                .HasColumnName("AuditStatus")
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsOptional();
            Property(t => t.CreateTime)
                .HasColumnName("CreateTime")
                .IsRequired();
            Property(t => t.Weight)
                .HasColumnName("Weight")
                .IsRequired();
            Property(t => t.WeightUnit)
                .HasColumnName("WeightUnit")
                .IsRequired();
            Property(t => t.Tax)
                .HasColumnName("Tax")
                .IsRequired();
            Property(t => t.FileCode)
                .HasColumnName("FileCode")
                .IsOptional();

        }
    }
}
